<?php
    namespace app\index\controller;
    use think\Controller;
    use app\index\model\User as UserModel;

    class User3  extends Controller
    {
        // 读取列表
        public function index()
        {
            /* $user = UserModel::all();
            $this->assign('list',$user);
            $this->assign('count',count($user));
            return $this->fetch(); */
            // 分页输出，每页显示3条
            $list = UserModel::paginate(3);
            $this->assign('list',$list);
            return $this->fetch();
        }
        // 读取单个信息
        public function read($id)
        {
            $user = UserModel::get($id);
            return view('read',['user'=>$user]);
        }
    }
?>